//------------------------------------------------------------------------------
#ifndef CPUFunctionH
#define CPUFunctionH
//------------------------------------------------------------------------------
#include <stdint.h>
//------------------------------------------------------------------------------
#pragma pack(push,1)
//------------------------------------------------------------------------------
class TCPUFunction
{
public:
    union TReg
    {
        uint32_t full;
        uint16_t two[2];
        uint8_t  four[4];
    };

public:
    TReg EAX,EBX,ECX,EDX;

    void operator()(int32_t _eax, int32_t _ecx=-1)
    {
        asm("mov %%esi, %%eax\n\t"
            "mov %%edi, %%ecx\n\t"
            "cpuid"
            : "=a" (EAX.full),
              "=b" (EBX.full),
              "=c" (ECX.full),
              "=d" (EDX.full)
            : "S"  (_eax),
              "D"  (_ecx));
    }

    void PrintVendorID();
    void PrintBrandID();
    void PrintBrandStr();
    void PrintGeneral();
    void PrintCache();
    void PrintFeature();
};
//------------------------------------------------------------------------------
#pragma pack(pop)
//------------------------------------------------------------------------------
#endif //Exclusive Include
//------------------------------------------------------------------------------
